<%--
  Created by IntelliJ IDEA.
  User: huangxianlong
  Date: 2021/4/1
  Time: 16:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title> 注册页</title>

</head>
<script src="<%=request.getContextPath()%>/js/jQuery.js"></script>
<link rel="stylesheet" href="<%= request.getContextPath()%>/css/register.css">
<!-- 引入 layui.css -->
<link rel="stylesheet" href="//unpkg.com/layui@2.6.7/dist/css/layui.css">
<!-- 引入 layui.js -->
<script src="//unpkg.com/layui@2.6.7/dist/layui.js"></script>

<body>
<div class="layui-card">
    <div class="layui-card-body">
        <h1>吃货注册</h1>
        <form action="<%= request.getContextPath()%>/register" method="post">
            <div>账号:<input class="input" type="text" name="account"></div>
            <div>密码:<input class="input" type="text" name="password"></div>
            <div>姓名:<input class="input" type="text" name="name"></div>
            <div style="display: flex;margin: 20px">
                <div style="flex: 2"></div>
                <div style="flex: 6;text-align: left"> 请选择: <SELECT name="sex" style="width: 60px">
                    <OPTION VALUE=""></OPTION>
                    <OPTION VALUE="男">男</OPTION>
                    <OPTION VALUE="女">女</OPTION>
                </SELECT></div>
                <div style="flex: 2"></div>
            </div>
            <button class="but" type="submit">注册</button>
            <a href="<%= request.getContextPath()%>/login.jsp">已有帐号，<span>去登录</span></a>
        </form>
    </div>
</div>
</body>

<script>
    $('form').submit(function () {
        let inputs = $('input');
        if (inputs.eq(0).val() == '') {
            layer.msg('账号不能为空', {icon: 2, offset: '80px'})
            return false;
        } else if (inputs.eq(1).val() == '') {
            layer.msg('密码不能为空', {icon: 2, offset: '80px'});
            return false;
        } else if (inputs.eq(2).val() == '') {
            layer.msg('姓名不能为空', {icon: 2, offset: '80px'});
            return false
        } else if (inputs.eq(3).val() == '') {
            layer.msg('性别不能为空', {icon: 2, offset: '80px'});
            return false
        }
    })
</script>
<%@include file="currency/base.jsp" %>
</html>
